<?php
/**
 * Created by JetBrains PhpStorm.
 * User: admin
 * Date: 03.02.13
 * Time: 14:01
 * To change this template use File | Settings | File Templates.
 */

class Application_Form_Action_Create extends Zend_Form
{
  public function init()
  {
    $this->setName('action_form')
      ->setMethod('post');

    $title = new Zend_Form_Element_Text('title');
    $title->setLabel('Заголовок')
      ->setAttrib('placeholder', 'Заголовок')
      ->addFilter(new Zend_Filter_StringTrim())
      ->addValidator(new Zend_Validate_NotEmpty())
      ->setRequired(true);
    $this->addElement($title);


    $body = new Zend_Form_Element_Textarea('body');
    $body->setLabel('Содержание')
      ->addValidator(new Zend_Validate_NotEmpty())
      ->setRequired(true);
    $this->addElement($body);

    $image = new Zend_Form_Element_File('image');
    $image->setAttrib('placeholder', 'Изображение')
      ->addValidator('Size', false, 1024000)
      ->addValidator('Extension', false, 'jpg,png,gif');
    $this->addElement($image);

    $submit = new Zend_Form_Element_Submit('submit');
    $submit->setLabel('Создать');
    $this->addElement($submit);
  }
}